#!/bin/sh
# 计算linux系统中所有进程占用内存的大小
sum=0
for mem in `ps aux | awk '{print $6}' | grep -v 'RSS'`
do
    sum=$[$sum+$mem]
done
echo "The total memory is $sum"